package com.ywjh.inter.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;

import com.ywjh.inter.entity.InsulinPenMedicineEntity;

public class InsulinPenMedicineDAO {

	public List<InsulinPenMedicineEntity> list(Connection conn) throws SQLException {
		List<InsulinPenMedicineEntity> list = new LinkedList<InsulinPenMedicineEntity>();
		PreparedStatement ps = conn.prepareStatement("select * from insulin_pen_medicine order by id desc");
		ResultSet rs = ps.executeQuery();
		while (rs.next()) {
			InsulinPenMedicineEntity a = new  InsulinPenMedicineEntity();
			a.setId(rs.getInt("id"));
			a.setDrugId(rs.getInt("drug_id"));
			a.setFactory(rs.getString("factory"));
			a.setName(rs.getString("name"));
			a.setCreateTime(rs.getString("create_time"));
			list.add(a);
		}
		return list;
	}
}
